package com.fly.demo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;

import com.fly.demo.mybatis.entity.MVCMybatisDemoUser;
import com.fly.demo.mybatis.mapper.MVCMybatisDemoUserMapper;
import com.fly.demo.service.GetUserInfoService;

/*
 *
 * @author paida 派哒 zeyu.pzy@alibaba-inc.com
 * @date 2020/10/27
 */
@Transactional
@Service
public class GetUserInfoServiceImpl implements GetUserInfoService
{
    @Autowired
    protected MVCMybatisDemoUserMapper mVCMybatisDemoUserMapper;
    
    @Override
    public void getUserInfoById(String id, Model model)
    {
        // search by id, get UserInfo
        MVCMybatisDemoUser user = mVCMybatisDemoUserMapper.queryUserInfo(id);
        model.addAttribute("name", user.getId()).addAttribute("age", user.getAge()).addAttribute("height", user.getHeight()).addAttribute("weight", user.getWeight());
    }
}
